#include "ChatServer.h"
#include "NetLib/NetConfig.h"

int main(int argc, char* argv[])
{
    if (argc < 2) {
        std::cerr << "Usage: chat_server <filename>\n";
        return -1;
    }

    NetConfig config;
    if (!config.Open(argv[1])) {
        std::cerr << "not found filename: " << argv[1] << std::endl;
        return -1;
    }

    const int port = config.GetInt("NetLib", "port", 1234);
    const size_t maxRoomNum = config.GetInt("ChatSvr", "MaxUserNum", 100);
    const size_t maxUserNum = config.GetInt("ChatSvr", "MaxRoomNum", 1000);

    CHATSVR.Open(port, maxUserNum, maxRoomNum);
    CHATSVR.Run();

    return 0;
}
